home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Education / Library Hyper Card Templates / Open Stack / Control / card_2897.txt < prev    next >
Encoding:
Text File  |  1987-12-04  |  20.5 KB  |  652 lines

  1. -- card: 2897 from stack: in
  2. -- bmap block id: 4048
  3. -- flags: 0000
  4. -- background id: 2702
  5. -- name: Command
  6. ----- HyperTalk script -----
  7. on openCard
  8.   global bookNumber,initGlobals
  9.   idle
  10.  
  11.   if initGlobals is false
  12.   then put bookNumber into card field "Book Number"
  13. end openCard
  14.  
  15. on initGlobals
  16.   answer "it works"
  17. end initGlobals
  18.  
  19. on idle
  20.   global timeInt
  21.   if (the seconds - timeInt > 30) then
  22.     put the long date into todayDate1
  23.     put the seconds into todayDate2
  24.  
  25.     convert todayDate2 to time
  26.     put todayDate1&"  "&todayDate2 into card field "today's date"
  27.     put the seconds into timeInt
  28.   end if
  29. end idle
  30.  
  31.  
  32.  
  33.  
  34. -- part 1 (button)
  35. -- low flags: 00
  36. -- high flags: 8003
  37. -- rect: left=20 top=226 right=261 bottom=222
  38. -- title width / last selected line: 0
  39. -- icon id / first selected line: 0 / 0
  40. -- text alignment: 1
  41. -- font id: 0
  42. -- text size: 12
  43. -- style flags: 0
  44. -- line height: 16
  45. -- part name: Make a Batch of New Cards
  46. ----- HyperTalk script -----
  47. on mouseUp
  48.   ask "Make how many new card sets?"
  49.   put it into num
  50.   if num is not empty then
  51.     put the long date into card field "today's date"
  52.     set lockScreen to true
  53.     push card
  54.     go to card 1 of stack "Acquisitions"
  55.  
  56.     put "To stop, click the mouse and wait a moment."
  57.     repeat with index =1 to num
  58.       send mkNewCard to stack "Acquisitions"
  59.       if index is 1 then
  60.         put index&&"set completed. To stop, click the mouse and wait a moment."
  61.       else
  62.         put index&&"sets completed. To stop, click the mouse and wait a moment."
  63.       end if
  64.       if the mouseClick then exit repeat
  65.     end repeat
  66.  
  67.     hide message box
  68.     if index is 1 then
  69.       answer index&&"card set completed."
  70.     else
  71.       answer index&&"card sets completed."
  72.     end if
  73.     pop card
  74.     set lockScreen to false
  75.   end if
  76. end mouseUp
  77.  
  78.  
  79.  
  80. -- part 2 (button)
  81. -- low flags: 00
  82. -- high flags: 0000
  83. -- rect: left=103 top=81 right=96 bottom=139
  84. -- title width / last selected line: 0
  85. -- icon id / first selected line: 0 / 0
  86. -- text alignment: 1
  87. -- font id: 0
  88. -- text size: 12
  89. -- style flags: 0
  90. -- line height: 16
  91. -- part name: Go To Acquisition
  92. ----- HyperTalk script -----
  93. on mouseUp
  94.   visual barn door open
  95.   go to stack "Acquisitions"
  96. end mouseUp
  97.  
  98.  
  99.  
  100. -- part 5 (button)
  101. -- low flags: 00
  102. -- high flags: 8003
  103. -- rect: left=369 top=270 right=291 bottom=495
  104. -- title width / last selected line: 0
  105. -- icon id / first selected line: 0 / 0
  106. -- text alignment: 1
  107. -- font id: 0
  108. -- text size: 12
  109. -- style flags: 0
  110. -- line height: 16
  111. -- part name: Find Overdues
  112. ----- HyperTalk script -----
  113. ----------------------- Open Stack‚Ñ¢ Copyright 1987----------------------
  114. ----------------------- by the Walking Shadow Press --------------------
  115. on mouseUp
  116.   ----------------------------------------------------------------
  117.   --  This handler updates the overdue notice stack "Overdue".  --
  118.   --  It proceeds by first deleting the cards in the current    --
  119.   --  "Overdue" stack and then recreates it by examining the    --
  120.   --  circulations stack to determine all overdue books.        --
  121.   --                                                            --
  122.   --  A new overdue card is created and filled with patron      --
  123.   --  information for each overdue book found.                  --
  124.   ----------------------------------------------------------------
  125.  
  126.   -------------------------------------------------------------------
  127.   --  This routine makes use of times that have been converted to  --
  128.   --  the seconds format.  When a time is converted to seconds,    --
  129.   --  it becomes the number of seconds since Jan 1, 1904.          --
  130.   --  First, we convert today's date to seconds...                 --
  131.   -------------------------------------------------------------------
  132.   put the short date into todayDate
  133.   convert todayDate to seconds
  134.  
  135.   set cursor to 4
  136.   ---------------------------------------------------------------------
  137.   -- The next command wipes the time out of the "today's date" field --
  138.   -- because it won't be updated while this routine is running.      --
  139.   -- This way, a user won't see an incorrect time on the screen.     --
  140.   ---------------------------------------------------------------------
  141.   put the long date into card field "today's date"
  142.   set lockScreen to true
  143.   push card
  144.  
  145.   go to stack "Overdue"
  146.  
  147.   ------------------------------------------------------------------
  148.   -- We start the overdue stack over by deleting all its cards... --
  149.   ------------------------------------------------------------------
  150.   put the number of cards into numCards
  151.   repeat for numCards-1 times
  152.     doMenu "Delete Card"
  153.   end repeat
  154.  
  155.   ---------------------------------------------------------------
  156.   -- The last card can't be deleted, so we empty its fields    --
  157.   -- instead...                                                --
  158.   -- First empty the card fields, if there are any...          --
  159.   ---------------------------------------------------------------
  160.   repeat with i = 1 to the number of card fields
  161.     put empty into card field i
  162.   end repeat
  163.  
  164.   -- ... and next, the background fields.  --
  165.   repeat with i = 1 to the number of fields
  166.     put empty into field i
  167.   end repeat
  168.  
  169.   ---------------------------------------------------------------
  170.   --  Now we go to the circulation stack and look for overdue  --
  171.   --  books.                                                   --
  172.   ---------------------------------------------------------------
  173.   go to stack "Circulation"
  174.  
  175.   ---------------------------------------------------------------
  176.   -- The count variable keeps track of the number of overdue   --
  177.   -- books found.  It will be used shortly.                    --
  178.   ---------------------------------------------------------------
  179.   put 0 into count
  180.  
  181.   -----------------------------------------------------------------
  182.   -- Now we loop through all the cards of the circulation stack  --
  183.   -- to see whether or not each book is overdue.                 --
  184.   -----------------------------------------------------------------
  185.   repeat for the number of cards
  186.     ---------------------------------------------------------
  187.     -- The processCircCard handler cleans the "Circ Field" --
  188.     -- up by deleting all empty lines and white space.     --
  189.     ---------------------------------------------------------
  190.     processCircCard
  191.  
  192.     -----------------------------------------------------------------
  193.     -- The following block of code is the main part of this        --
  194.     -- routine.  For each card in the circulation stack, the book  --
  195.     -- it represents has been returned if the "Returned" field     --
  196.     -- is 1.                                                       --
  197.     --                                                             --
  198.     -- So, if the "Returned" field is 1, we skip everything and    --
  199.     -- go on to the next card.                                     --
  200.     --                                                             --
  201.     -- The next condition checks to see if the entire "Circ field" --
  202.     -- field is empty, in which case we also skip everything and   --
  203.     -- go on to the next card.                                     --
  204.     --                                                             --
  205.     -- The words of each line of field "Circ Field" consist of:    --
  206.     -- (checkout date) (due date) (patron number).                 --
  207.     --                                                             --
  208.     -- The patron number is checked to see if it exists.  If it    --
  209.     -- doesn't, something is wrong, and an error is flagged.       --
  210.     --                                                             --
  211.     -- Provided all of the above checks out ok, the due date is    --
  212.     -- next converted to seconds and compared to today's date.     --
  213.     -- If the due date is less than today's date, the book is      --
  214.     -- overdue, so we process the overdue card in the handler      --
  215.     -- processOverdue by passing it the patron's number, the       --
  216.     -- date the book is due, and the number of overdue books       --
  217.     -- found so far (See the comments in processOverdue.).         --
  218.     -----------------------------------------------------------------
  219.     if field "Returned" is not 1 then
  220.       put last line of field "Circ Field" into lastLine
  221.       if (lastLine is not empty) then
  222.         put word 3 of lastLine into patronNumber
  223.         if patronNumber is not empty then
  224.           put word 2 of lastLine into dueDate
  225.           convert dueDate to seconds
  226.           if dueDate < todayDate then
  227.             add 1 to count
  228.             convert dueDate to short date
  229.             processOverdue patronNumber, dueDate, count
  230.           end if
  231.         else
  232.           -- Flag circ card error, patron number is empty.
  233.         end if
  234.       end if
  235.     end if
  236.     go to next card
  237.   end repeat
  238.  
  239.   pop card
  240.   set lockScreen to false
  241. end mouseUp
  242.  
  243. on processCircCard
  244.   ---------------------------------------------------------------
  245.   -- This routine processes each circulation card by deleting  --
  246.   -- any empty lines in its "Circ Field" field.  If the first  --
  247.   -- word of a line is empty, it means no words at all         --
  248.   -- exist on that line, so the line is deleted.               --
  249.   ---------------------------------------------------------------
  250.  
  251.   repeat with i = the number of lines in field "Circ Field" down to 1
  252.     if word 1 of line i of field "Circ Field" is empty then
  253.       delete line i of field "Circ Field"
  254.     end if
  255.   end repeat
  256. end processCircCard
  257.  
  258. on processOverdue patronNumber, dueDate, count
  259.   -----------------------------------------------------------------
  260.   -- This handler processes an overdue book that appears on      --
  261.   -- the current circulation card.                               --
  262.   -- We must gather information about the patron to make an      --
  263.   -- overdue card for the "Overdue" stack.                       --
  264.   --                                                             --
  265.   -- First, we get some info. from the current circulation card. --
  266.   -----------------------------------------------------------------
  267.  
  268.   put field "author" into bookAuthor
  269.   put field "title" into bookTitle
  270.   put field "book Number" into bookNumber
  271.  
  272.   --------------------------------------------------------------
  273.   -- Next, we pass to the "Patron" stack to gather more info. --
  274.   -- on the patron.                                           --
  275.   --------------------------------------------------------------
  276.   push card
  277.   go to stack "Patron"
  278.  
  279.   ------------------------------------------------------------------
  280.   -- We must first find the proper patron's card in the "Patron"  --
  281.   -- stack.                                                       --
  282.   -- If there is no card for the patron's number, something is    --
  283.   -- wrong and an error should be flagged.                        --
  284.   ------------------------------------------------------------------
  285.   find patronNumber in field "Patron Number"
  286.   if patronNumber is not field "Patron Number" then
  287.     -- Flag error, patron doesn't exist.
  288.   else
  289.     put field "Patron Name" into patName
  290.     put field "Patron Address" into patAddress
  291.  
  292.     -------------------------------------------------------------------
  293.     -- Finally we go to the "Overdue" stack and load the information --
  294.     -- that has been gathered onto an overdue card notice.           --
  295.     --                                                               --
  296.     -- Count records how many overdues have been processed.  If it   --
  297.     -- is 1, we need not create a new card on the "Overdue" stack    --
  298.     -- because the first card (which is never deleted) is already    --
  299.     -- there.                                                        --
  300.     -------------------------------------------------------------------
  301.     go to stack "Overdue"
  302.     if count > 1 then doMenu "New Card"
  303.  
  304.     put bookTitle into field "Title"
  305.     put dueDate into field "Due Date"
  306.     put patronNumber into field "Patron Number"
  307.     put bookAuthor into field "Author"
  308.     put bookNumber into field "Book Number"
  309.     put patName into field "Patron Name"
  310.     put patAddress into field "Patron Address"
  311.  
  312.   end if
  313.  
  314.   pop card -- This returns us to stack "Circulation".
  315. end ProcessOverdue
  316. -------------------------- End Open Stack‚Ñ¢ ------------------------
  317.  
  318.  
  319. -- part 11 (field)
  320. -- low flags: 00
  321. -- high flags: 0000
  322. -- rect: left=348 top=218 right=236 bottom=420
  323. -- title width / last selected line: 0
  324. -- icon id / first selected line: 0 / 0
  325. -- text alignment: 0
  326. -- font id: 3
  327. -- text size: 12
  328. -- style flags: 0
  329. -- line height: 16
  330. -- part name: Book Number
  331. ----- HyperTalk script -----
  332. on closeField
  333.   global bookNumber
  334.   put card field "Book Number" into bookNumber
  335. end closeField
  336.  
  337.  
  338. -- part 13 (button)
  339. -- low flags: 00
  340. -- high flags: E005
  341. -- rect: left=230 top=235 right=258 bottom=363
  342. -- title width / last selected line: 0
  343. -- icon id / first selected line: 0 / 0
  344. -- text alignment: 1
  345. -- font id: 0
  346. -- text size: 12
  347. -- style flags: 0
  348. -- line height: 16
  349. -- part name: Auto Numbering
  350. ----- HyperTalk script -----
  351. on mouseUp
  352.   global autoNumbering
  353.   put the hilite of button "Auto Numbering" into autoNumbering
  354. end mouseUp
  355.  
  356.  
  357.  
  358. -- part 17 (field)
  359. -- low flags: 01
  360. -- high flags: 0000
  361. -- rect: left=16 top=36 right=52 bottom=315
  362. -- title width / last selected line: 0
  363. -- icon id / first selected line: 0 / 0
  364. -- text alignment: 0
  365. -- font id: 3
  366. -- text size: 12
  367. -- style flags: 0
  368. -- line height: 16
  369. -- part name: today's date
  370.  
  371.  
  372. -- part 18 (button)
  373. -- low flags: 00
  374. -- high flags: 0000
  375. -- rect: left=141 top=59 right=73 bottom=181
  376. -- title width / last selected line: 0
  377. -- icon id / first selected line: 0 / 0
  378. -- text alignment: 1
  379. -- font id: 0
  380. -- text size: 12
  381. -- style flags: 0
  382. -- line height: 16
  383. -- part name: Vendor
  384. ----- HyperTalk script -----
  385. on mouseUp
  386.   go to stack "Vendor"
  387. end mouseUp
  388.  
  389.  
  390.  
  391. -- part 19 (button)
  392. -- low flags: 00
  393. -- high flags: 0000
  394. -- rect: left=162 top=82 right=97 bottom=208
  395. -- title width / last selected line: 0
  396. -- icon id / first selected line: 0 / 0
  397. -- text alignment: 1
  398. -- font id: 0
  399. -- text size: 12
  400. -- style flags: 0
  401. -- line height: 16
  402. -- part name: Return Slip
  403. ----- HyperTalk script -----
  404. on mouseUp
  405.   go to stack "Return Note"
  406. end mouseUp
  407.  
  408.  
  409.  
  410. -- part 20 (button)
  411. -- low flags: 00
  412. -- high flags: 0000
  413. -- rect: left=138 top=105 right=120 bottom=174
  414. -- title width / last selected line: 0
  415. -- icon id / first selected line: 0 / 0
  416. -- text alignment: 1
  417. -- font id: 0
  418. -- text size: 12
  419. -- style flags: 0
  420. -- line height: 16
  421. -- part name: Catalog
  422. ----- HyperTalk script -----
  423. on mouseUp
  424.   go to stack "Cataloging"
  425. end mouseUp
  426.  
  427.  
  428.  
  429. -- part 21 (button)
  430. -- low flags: 00
  431. -- high flags: 0000
  432. -- rect: left=41 top=130 right=145 bottom=87
  433. -- title width / last selected line: 0
  434. -- icon id / first selected line: 0 / 0
  435. -- text alignment: 1
  436. -- font id: 0
  437. -- text size: 12
  438. -- style flags: 0
  439. -- line height: 16
  440. -- part name: Reserve Note
  441. ----- HyperTalk script -----
  442. on mouseUp
  443.   go to stack "Reserve Note"
  444. end mouseUp
  445.  
  446.  
  447.  
  448. -- part 22 (button)
  449. -- low flags: 00
  450. -- high flags: 0000
  451. -- rect: left=162 top=131 right=146 bottom=208
  452. -- title width / last selected line: 0
  453. -- icon id / first selected line: 0 / 0
  454. -- text alignment: 1
  455. -- font id: 0
  456. -- text size: 12
  457. -- style flags: 0
  458. -- line height: 16
  459. -- part name: Overdue Note
  460. ----- HyperTalk script -----
  461. on mouseUp
  462.   go to stack "Overdue Note"
  463. end mouseUp
  464.  
  465.  
  466.  
  467. -- part 23 (button)
  468. -- low flags: 00
  469. -- high flags: 0000
  470. -- rect: left=103 top=130 right=145 bottom=139
  471. -- title width / last selected line: 0
  472. -- icon id / first selected line: 0 / 0
  473. -- text alignment: 1
  474. -- font id: 0
  475. -- text size: 12
  476. -- style flags: 0
  477. -- line height: 16
  478. -- part name: Circulation
  479. ----- HyperTalk script -----
  480. on mouseUp
  481.   go to stack "Circulation"
  482. end mouseUp
  483.  
  484.  
  485.  
  486. -- part 24 (button)
  487. -- low flags: 00
  488. -- high flags: 0000
  489. -- rect: left=137 top=157 right=171 bottom=177
  490. -- title width / last selected line: 0
  491. -- icon id / first selected line: 0 / 0
  492. -- text alignment: 1
  493. -- font id: 0
  494. -- text size: 12
  495. -- style flags: 0
  496. -- line height: 16
  497. -- part name: Overdue
  498. ----- HyperTalk script -----
  499. on mouseUp
  500.   go to stack "Overdue"
  501. end mouseUp
  502.  
  503.  
  504.  
  505. -- part 25 (button)
  506. -- low flags: 00
  507. -- high flags: 0000
  508. -- rect: left=65 top=105 right=120 bottom=101
  509. -- title width / last selected line: 0
  510. -- icon id / first selected line: 0 / 0
  511. -- text alignment: 1
  512. -- font id: 0
  513. -- text size: 12
  514. -- style flags: 0
  515. -- line height: 16
  516. -- part name: Labels
  517. ----- HyperTalk script -----
  518. on mouseUp
  519.   go to stack "Labels"
  520. end mouseUp
  521.  
  522.  
  523.  
  524. -- part 26 (button)
  525. -- low flags: 00
  526. -- high flags: 0000
  527. -- rect: left=66 top=157 right=171 bottom=106
  528. -- title width / last selected line: 0
  529. -- icon id / first selected line: 0 / 0
  530. -- text alignment: 1
  531. -- font id: 0
  532. -- text size: 12
  533. -- style flags: 0
  534. -- line height: 16
  535. -- part name: Patron
  536. ----- HyperTalk script -----
  537. on mouseUp
  538.   go to stack "Patron"
  539. end mouseUp
  540.  
  541.  
  542.  
  543. -- part 29 (button)
  544. -- low flags: 00
  545. -- high flags: 8003
  546. -- rect: left=370 top=293 right=315 bottom=496
  547. -- title width / last selected line: 0
  548. -- icon id / first selected line: 0 / 0
  549. -- text alignment: 1
  550. -- font id: 0
  551. -- text size: 12
  552. -- style flags: 0
  553. -- line height: 16
  554. -- part name: Process Reserves
  555. ----- HyperTalk script -----
  556. on mouseUp
  557.   ---------------------------------------------------------------
  558.   --  This routine processes the reserve stack by deleting all --
  559.   --  the cards for reserved books that have over-run their    --
  560.   --  reserve hold periods.                                    --
  561.   ---------------------------------------------------------------
  562.  
  563.   ---------------------------------------------------------
  564.   --  Erase the time so people don't get disoriented...  --
  565.   ---------------------------------------------------------
  566.   put the long date into card field "today's date"
  567.   set cursor to 4
  568.   set lockScreen to true
  569.   push card
  570.   go to stack "Reserve Note"
  571.   ------------------------------------------------------------
  572.   --  We must compare the hold date to today's date in the  --
  573.   --  seconds format.                                       --
  574.   ------------------------------------------------------------
  575.   put the short date into todayDate
  576.   convert todayDate to seconds
  577.  
  578.   ---------------------------------------------------------------
  579.   -- When a reserve notice is deleted, we must also delete the --
  580.   -- patron's number off the reserve list for that book, if,   --
  581.   -- that is, it still exists.  bookList records the list of   --
  582.   -- book numbers for the deleted reserve notices, and         --
  583.   -- patronList the corresponding patron numbers.              --
  584.   ---------------------------------------------------------------
  585.   put empty into bookList
  586.   put empty into patronList
  587.   repeat with i = the number of cards down to 1
  588.     go to card i
  589.     --------------------------------------------------------------
  590.     -- Compare the hold date to today's date and delete the     --
  591.     -- card if the reserve has run out...                       --
  592.     --------------------------------------------------------------
  593.     put field "Hold Date" of card i into holdDate
  594.     convert holdDate to seconds
  595.     if holdDate < todayDate then
  596.       put space & field "Book Number" after bookList
  597.       put space & field "Patron Number" after patronList
  598.       if the number of cards > 1 then
  599.         doMenu "Delete Card"
  600.       else
  601.         repeat with k = 1 to 7
  602.           put empty into field k
  603.         end repeat
  604.       end if
  605.     end if
  606.   end repeat
  607.  
  608.   -----------------------------------------------------------------
  609.   --  Next we go to the circulation stack and take the patron's  --
  610.   --  number off the top of the reserve list if its still there  --
  611.   --  bookList contains the book numbers that we look at and     --
  612.   --  patronList patron's number who reserved the book.          --
  613.   -----------------------------------------------------------------
  614.   if word 1 of bookList is not empty then
  615.     go to stack "Circulation"
  616.  
  617.     -- Cycle through the book numbers of bookList...--
  618.  
  619.     repeat with i = 1 to the number of words in bookList
  620.       find word i in field "Book Number"
  621.       processField "Reserve Field" -- Tidy the reserve field.
  622.       --------------------------------------------------------
  623.       --  And delete the top patron number off the reserve  --
  624.       --  list only if it agrees with the patron number     --
  625.       --  whose reserve ran out.                            --
  626.       --------------------------------------------------------
  627.       if (field "Reserve Field" is not empty) and (word 1 of line 1 of field "Reserve Field" is word i of patronList)
  628.       then delete line 1 of field "Reserve Field"
  629.     end repeat
  630.   end if
  631.  
  632.   pop card
  633.   set lockScreen to false
  634. end mouseUp
  635.  
  636.  
  637.  
  638. -- part contents for card part 6
  639. ----- text -----
  640. 3000
  641.  
  642. -- part contents for card part 8
  643. ----- text -----
  644. 3004
  645.  
  646. -- part contents for card part 10
  647. ----- text -----
  648. 3004
  649.  
  650. -- part contents for card part 17
  651. ----- text -----
  652. Friday, December 4, 1987  4:09 PM